﻿@using Microsoft.Extensions.Options;
@using SimpleIdServer.FastFed.IdentityProvider.Startup.Resources;
@model SimpleIdServer.FastFed.IdentityProvider.Provisioning.Scim.UI.FastFedAppProviderConfigureViewModel;

@{
    ViewBag.Title = ScimProvisioning.ConfigureScimProvisioning;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h3>@ScimProvisioning.ConfigureScimProvisioning</h3>

@if(Model.IsConfirmed)
{
    <div class="alert alert-success" role="alert">
        @ScimProvisioning.ScimProvisioningIsConfigured
    </div>
}
else
{
    <div class="card">
        <div class="card-body">
            <form asp-controller="FastFedAppProvider" asp-action="Configure" asp-area="scim" method="post">
                @Html.AntiForgeryToken()
                <input type="hidden" value="@Model.EntityId" name="EntityId" />
                <!-- Authentication type -->
                <div class="mb-3">
                    <label class="form-label">@ScimProvisioning.AuthenticationType</label>
                    <select class="form-control" name="Configuration.AuthenticationType">
                        <option value="0">@ScimProvisioning.OAUTH</option>
                        <option value="1">@ScimProvisioning.ApiKey</option>
                    </select>
                </div>
                <!-- Api secret -->
                <div class="mb-3">
                    <label class="form-label">@ScimProvisioning.ApiSecret</label>
                    <input type="text" class="form-control" name="Configuration.ApiSecret" />
                </div>
                <!-- ClientId -->
                <div class="mb-3">
                    <label class="form-label">@ScimProvisioning.ClientId</label>
                    <input type="text" class="form-control" name="Configuration.ClientId" />
                </div>
                <!-- ClientSecret -->
                <div class="mb-3">
                    <label class="form-label">@ScimProvisioning.ClientSecret</label>
                    <input type="password" class="form-control" name="Configuration.ClientSecret" />
                </div>
                <button type="submit" class="btn btn-primary">@ScimProvisioning.Update</button>
            </form>
        </div>
    </div>
}